package com.ytjj.qmyx.supplychain.common.utils;

import java.util.Map;

/**
 * @Description 快递字典
 *
 * 
 * 
 * @Version 1.0
 **/
public class ExpressDicUtil {

    private static Map<String,String> expressDicMap;

    private ExpressDicUtil(){}

    public static String getValue(String key){
        return expressDicMap.get(key);
    }

    public static void into(Map<String,String> map){
        expressDicMap = map;
    }

    public static Boolean containKey(String key) {
        return expressDicMap.containsKey(key);
    }

    /**
     * @Description 通过map value获取key
     *
     * 
     * 
     * @Version 1.0
     *
     * @return*/
    public static String getMapKey(String value) {
        for (String key : expressDicMap.keySet()) {
            if (expressDicMap.get(key).equals(value)) {
                return key;
            }
        }
        return null;
    }


    public static String getMapValue(String key) {
        for (String value : expressDicMap.values()) {
            if (expressDicMap.get(key).equals(value)) {
                return value;
            }
        }
        return null;
    }
}
